<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="sitemesh" uri="http://www.opensymphony.com/sitemesh/decorator" %>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>

<div class="panel_container">

    <div class="panel">
        <form id="form_search">
            <div class="panel_header">
                <div><h2>数据上报文件历史</h2></div>
            </div>

            <div class="panel_body">
            </div>

            <div class="panel_footer">
                <div>
                    <div class="info_item ml_1">
                        <input type="button" value="查询" class="btn_blue" id="btn_search">&nbsp;
                        <input id="createEntity" class="btn_blue" type="button" value="生成文件">
                    </div>
                </div>
            </div>
        </form>
    </div>

    <div class="panel">
        <div class="panel_body">
            <div>
                <table id="grid_tbl"></table>
                <div id="pager"></div>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
    function gotoCreatePage(){
        linkTo("${ctx}/report/toGenerate");
    }



    function refreshList(){
        jQuery("#grid_tbl").setGridParam({url:"${ctx}/report/reportList"}).trigger("reloadGrid");
    }

    $(function () {
        $("#createEntity").bind("click", function(){
            gotoCreatePage();
        });

        $("#btn_search").bind("click", function(){
            refreshList();
        });

        $("#grid_tbl").jqGrid({
            datatype: "json",
            url: "${ctx}/report/reportList",
            mtype: "POST",
            width: "100%",
            height: "100%",
            colNames: ['id','操作', '业务类型', '业务年月', '上报文件名', '上报文件路径', '上报人', '上报时间'],
            colModel: [
                {name: 'id', index: 'id', hidden:true, label:'id'},
                {name:'act',index:'id',search:false,sortable:false,editable:false, label:'操作',width:50
                    ,formatter:function(cellvalue, options, rowObject){
                        return "<a  href='${ctx}/file/down?fileName="+rowObject.fileName+"&url="+rowObject.fileUrl+"'>下载</a>";

                    }
                },
                {name: 'businessType', index: 'businessType', sortable: false,label:'业务类型',
                    formatter:function(cellvalue, options, rowObject){
                        return rowObject.businessTypeDesc;
                    }
                },
                {name: 'businessMonth', index: 'businessMonth', sortable: false,label:'业务年月'},
                {name: 'fileName', index: 'fileName', sortable: false,label:'上报文件名'},
                {name: 'fileUrl', index: 'fileUrl', sortable: false, label:'上报文件路径'},
                {name: 'reportMan', index: 'reportMan', sortable: false,label:'上报人'},
                {name: 'reportDate', index: 'reportDate', sortable: false,label:'上报时间'}
            ],
            rowNum: 20,
            rowList: [20, 50, 100],
            pager: '#pager',
            imgpath: 'images',
            sortname: 'id',
            viewrecords: true,
            sortorder: "desc",
            autowidth: true,
            jsonReader: {
                repeatitems: false,
                id: "id"
            },
            caption: "数据上报历史查询结果列表"
        });

    });

</script>